package com.easyUploader.controller;

import com.easyUploader.entity.vo.DirectoryVo;
import com.easyUploader.service.IDirectoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import com.common.result.ResponseResultAdvice;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author 大忽悠
 * @create 2022/9/15 11:09
 */
@Validated
@RestController
@RequestMapping("/directory")
@RequiredArgsConstructor
@ResponseResultAdvice
@Api(tags="目录请求")
public class DirectoryController {
    private final IDirectoryService iDirectoryService;

    @ApiOperation("创建目录")
    @PostMapping("/create")
    public void createDirectory(@Valid DirectoryVo directoryVo){
          iDirectoryService.createDirectory(directoryVo);
    }

    @ApiOperation("删除目录")
    @DeleteMapping("/delete")
    public void deleteDirectory(@Valid DirectoryVo directoryVo){
        iDirectoryService.deleteDirectory(directoryVo);
    }
}
